package com.sinothk.special.friendship.controller;

import com.sinothk.special.friendship.service.IFriendshipLinkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 友谊关系维护
 * @Author: Liangyt
 * @Date: 2022-06-15
 * @Version: V1.0
 */
@Api(tags = "友谊关系维护")
@RestController
@RequestMapping("/friendship/link")
@Slf4j
public class FriendshipLinkController {
    @Autowired
    private IFriendshipLinkService friendshipLinkService;

    /**
     * 关注
     *
     * @param friendUid
     * @return
     */
    @AutoLog(value = "关注")
    @ApiOperation(value = "关注", notes = "关注")
    @GetMapping(value = "/addFriend")
    public Result<?> addFriend(@RequestParam("friendUid") String friendUid) {
        friendshipLinkService.addFriend(friendUid);
        return Result.OK("关注成功!");
    }

    /**
     * 取消关注
     *
     * @param friendUid
     * @return
     */
    @AutoLog(value = "取消关注")
    @ApiOperation(value = "取消关注", notes = "取消关注")
    @GetMapping(value = "/delFriend")
    public Result<?> delFriend(@RequestParam("friendUid") String friendUid) {
        friendshipLinkService.delFriend(friendUid);
        return Result.OK("取消关注成功!");
    }

    /**
     * 拉黑
     *
     * @param friendUid
     * @return
     */
    @AutoLog(value = "拉黑")
    @ApiOperation(value = "拉黑", notes = "拉黑")
    @GetMapping(value = "/removeBlackList")
    public Result<?> removeBlackList(@RequestParam("friendUid") String friendUid) {
        friendshipLinkService.removeBlackList(friendUid);
        return Result.OK("拉黑成功!");
    }

//	/**
//	 * 分页列表查询
//	 *
//	 * @param friendshipLink
//	 * @param pageNo
//	 * @param pageSize
//	 * @param req
//	 * @return
//	 */
//	@AutoLog(value = "友谊关系维护-分页列表查询")
//	@ApiOperation(value="友谊关系维护-分页列表查询", notes="友谊关系维护-分页列表查询")
//	@GetMapping(value = "/list")
//	public Result<?> queryPageList(FriendshipLink friendshipLink,
//								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
//								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
//								   HttpServletRequest req) {
//		QueryWrapper<FriendshipLink> queryWrapper = QueryGenerator.initQueryWrapper(friendshipLink, req.getParameterMap());
//		Page<FriendshipLink> page = new Page<FriendshipLink>(pageNo, pageSize);
//		IPage<FriendshipLink> pageList = friendshipLinkService.page(page, queryWrapper);
//		return Result.OK(pageList);
//	}
//	/**
//	 *   添加
//	 *
//	 * @param friendshipLink
//	 * @return
//	 */
//	@AutoLog(value = "友谊关系维护-添加")
//	@ApiOperation(value="友谊关系维护-添加", notes="友谊关系维护-添加")
//	@PostMapping(value = "/add")
//	public Result<?> add(@RequestBody FriendshipLink friendshipLink) {
//		friendshipLinkService.save(friendshipLink);
//		return Result.OK("添加成功！");
//	}
//
//	/**
//	 *  编辑
//	 *
//	 * @param friendshipLink
//	 * @return
//	 */
//	@AutoLog(value = "友谊关系维护-编辑")
//	@ApiOperation(value="友谊关系维护-编辑", notes="友谊关系维护-编辑")
//	@PutMapping(value = "/edit")
//	public Result<?> edit(@RequestBody FriendshipLink friendshipLink) {
//		friendshipLinkService.updateById(friendshipLink);
//		return Result.OK("编辑成功!");
//	}
//
//	/**
//	 *   通过id删除
//	 *
//	 * @param id
//	 * @return
//	 */
//	@AutoLog(value = "友谊关系维护-通过id删除")
//	@ApiOperation(value="友谊关系维护-通过id删除", notes="友谊关系维护-通过id删除")
//	@DeleteMapping(value = "/delete")
//	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
//		friendshipLinkService.removeById(id);
//		return Result.OK("删除成功!");
//	}
}
